home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 11 / Info-Mac_XI_Disc_1.cdr_ / Info-Mac XI Disc 1.cdr / Programs / Science & Math / MacEspresso 1.0 / espresso / canonical.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-10  |  1.4 KB  |  72 lines  |  [TEXT/R*ch]

  1. /* Module:canonical.c
  2.  *    contains routines for finding the canonical cover of the 
  3.  *    incompletely specified logic function.    
  4.  * Routine:
  5.  * pcover find_canonical_cover():
  6.  *    Finds canonical cover of the incompletely specified logic function
  7.  *    by iteratively calling ess_test_and_reduction for each cube in the
  8.  *    ON-set.
  9.  */
  10.  
  11. #include <stdio.h>
  12. #include "espresso.h"
  13. #include "signature.h"
  14.  
  15. /*
  16.  * find_canonical_cover
  17.  * Objective: find canonical cover of the essential signature cube
  18.  * Input:
  19.  *    F: ONSET cover;
  20.  *    D: DC cover;
  21.  *    R: OFFSET cover;
  22.  * Output:
  23.  *    Return canonical cover of the essential signature cube
  24.  */
  25. pcover find_canonical_cover(pcover F1,pcover D,pcover R)
  26. {
  27.     pcover F;
  28.     pcover E,ESC;
  29.     pcover COVER;
  30.     pcube last,p,s;
  31.     pcube c;
  32.     int count = 0;
  33.     int last_fcount = F1->count;
  34.     pcube d, *extended_dc;
  35.     pcube sigma_c;
  36.  
  37.     F = sf_save(F1);
  38.     E = new_cover(D->count);
  39.     E->count = D->count;
  40.     sf_copy(E,D);
  41.  
  42.     ESC = new_cover(F->count);
  43.     
  44.     while(F->count){
  45.         c = GETSET(F,--F->count);
  46.         RESET(c,NONESSEN);
  47.         extended_dc = cube2list(E,F);
  48.         d = reduce_cube(extended_dc,c);
  49.         free_cubelist(extended_dc);
  50.         if(setp_empty(d)){
  51.             free_cube(d);
  52.             continue;
  53.         }
  54.         c = get_sigma(R,d);
  55.         S_EXECUTE(COVER = etr_order(F,E,R,c,d),ETR_TIME);
  56.         free_cube(d);
  57.         if(TESTP(c,NONESSEN)){
  58.             sf_append(F,COVER);
  59.         }
  60.         else{
  61.             free_cover(COVER);
  62.             sf_addset(E,c);
  63.             sf_addset(ESC,c);
  64.         }
  65.         free_cube(c);
  66.     }
  67.     free_cover(F);
  68.     free_cover(E);
  69.  
  70.     return ESC;
  71. }
  72.